package com.dshore.messagecenter.controller.technology;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.baidu.ueditor.ActionEnter;

@Controller
@RequestMapping("/index")
public class UEditorController {

	@RequestMapping("/toFWB")
	public ModelAndView IntoChangeStyle() {
		ModelAndView mv=new ModelAndView("fuwenben");
		mv.setViewName("technology/fuwenben");
		return mv;
	}
	
	@RequestMapping("/demo")
	public String UEditorDemo() {
		
		return "index";
	}
	
	
	@RequestMapping(value="/config")
    public void config(HttpServletRequest request, HttpServletResponse response) {
        response.setContentType("application/json");
        String rootPath = request.getSession().getServletContext().getRealPath("/");
        try {
            String exec = new ActionEnter(request, rootPath).exec();
            PrintWriter writer = response.getWriter();
            writer.write(exec);
            writer.flush();
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
 
    }

}
